/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ro.unibuc.hobbygroups.controllers;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.ParameterizableViewController;
import ro.unibuc.hobbygroups.service.UsersService;

/**
 *
 * @author Root
 */
public class UsersController extends ParameterizableViewController {

    private UsersService usersService;

    public UsersController() {
    }

    protected ModelAndView handleRequestInternal(
            HttpServletRequest request,
            HttpServletResponse response) throws Exception {

        ModelAndView mav = new ModelAndView(getViewName());
        mav.addObject("users", usersService.findAll());
        return mav;
    }

    @Required
    public void setUsersService(UsersService usersService) {
        this.usersService = usersService;
    }

}